/*
 * @Author: sdorein sdorein@163.com
 * @Date: 2024-07-26 10:17:08
 * @LastEditors: sdorein sdorein@163.com
 * @LastEditTime: 2024-07-26 10:36:33
 * @FilePath: \node-ts-project\server\upload1.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
console.log("我来了，宝贝")
const ci = require('miniprogram-ci')
const fs = require('fs');  
if (!fs.existsSync('dist/mp')) {  
    console.error('目录 dist/mp 不存在');  
  }  
  if (!fs.existsSync('privatekey')) {  
    console.error('私钥文件 privatekey 不存在');  
  }
;(async () => {
  const project = new ci.Project({
    appid: 'wx70a595fc42f347f0',
    type: 'miniProgram',
    projectPath: 'dist/mp',
    privateKeyPath: 'privatekey/private.wx70a595fc42f347f0.key',
    ignores: ['node_modules/**/*'],
  })
  const uploadResult = await ci.upload({
    project,
    version: '1.1.1',
    desc: 'hello',
    setting: {
      es6: true,
    },
    onProgressUpdate: console.log,
  })
  console.log("上传结果：",uploadResult)
})()